home *** CD-ROM | disk | FTP | other *** search
- > Hello. It's me again, i wrote the question abouth procedures &
- > Gosub's some hours ago, but i just relised that it is less than 20
- > days to the big computer party here in Norway called The
- > Gathering, and i have to be finnished with the code for the
- > diskmag i'am working on before The Gathering starts.
- > So PLEEEZ ansver my question FAAAAASSST!!!
-
- Okay. Let's have a look at the first post... :-)
-
-
- > I have a little coding problem that i think most of you are able to
- > help me out with quite easily.
-
- > A
- > Procedure A
- > B
- > End Proc
- > Procedure B
- > A
- > End Proc
- > This will cause a out or stack error becos it writes the same data
- > one time for each loop until you are out of stack space, Right??
-
- Correct. Calling procedures stores data on the stack, but
- the End Proc is never reached (nor Pop Proc), so this data is
- never removed from the stack.
-
-
- > But how do you make this work???
-
- Make WHAT work? What are you trying to do??
-
-
- > And will it be better to do it like this??
- > MOVMENT:
- > (some code)
- > Return
- > Procedure A
- > Do
- > (some code)
- > Gosub MOVMENT
- > Loop
- > End Proc
-
- Again, I'm not sure what you're trying to do. I can't see why
- you want an infinite loop rather than some conditional loop like
- While SOMETHING or Repeat Until SOMETHING.
-
-
- > With this i don't get it to jump out of the procedure and go to
- > Movment: and return back into the procedure. I tryed Global
- > movment but that did'nt help at all :(
-
- When you call procedure A, it should continually Gosub
- MOVMENT. The code in MOVMENT will be executed then
- the Return statement will bring control back to the line after
- the Gosub (in Procedure A) which is Loop, so this process will
- repeat again... and again... and...
-
-
- > The reason i want it to be like one of these examples is that i'm
- > gonna have 6 procedures and then it takes up too much space
- > and memory to have the code in movment 6 times, when i don't
- > need to have it more than one time.
-
- It would help tremendously if you could give us a snip of the
- actual program code or describe exactly what you are trying
- to achieve.
-
- Based on the above, all I can say is try something like this:
-
- Procedure ONE
- DoYourStuff
- End Procedure
- ... same for TWO, THREE, FOUR, FIVE. All the way up to...
- Procedure SIX
- DoYourStuff
- End Proc
-
- ALLDONE=False
- Repeat
- ProcessSomeStuffHere
- SortOutWhichProcedureToCall
- CallTheProcedureHere (MOVMENT, ONE, TWO, THREE, etc.)
-
- CheckForExitCondition. If ReadyToExit Set ALLDONE=True
- Until ALLDONE
-
- I really need more info on what you're after as I can't see what
- the problem is. :-)
-
-
- Garfield Benjamin e-mail:gbenjam@sosbbs.com
- Website( http://www.sosbbs.com/~gbenjam ): 50% Complete
-
-